package com.qsl.ssyx.user.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.qsl.ssyx.enums.user.UserDelivery;
import com.qsl.ssyx.user.mapper.UserDeliveryMapper;
import com.qsl.ssyx.user.service.UserDeliveryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 会员提货记录表 服务实现类
 * </p>
 *
 * @author 青衫泪
 * @since 2023-08-30
 */
@Service
public class UserDeliveryServiceImpl extends ServiceImpl<UserDeliveryMapper, UserDelivery> implements UserDeliveryService {

    // 根据userId查询是否唯一
    @Override
    public UserDelivery getUserDeliveryOneByUserId(Long userId) {
        LambdaQueryWrapper<UserDelivery> lqw = new LambdaQueryWrapper<>();
        lqw.eq(UserDelivery::getUserId, userId);
        lqw.eq(UserDelivery::getIsDefault, 1); // 是否默认
        return baseMapper.selectOne(lqw);
    }
}
